package com.hebeiwangxiaozhang.user.service.controller;

import com.hebeiwangxiaozhang.response.CommonResponse;
import com.hebeiwangxiaozhang.response.ResponseUtils;
import com.hebeiwangxiaozhang.user.service.pojo.User;
import com.hebeiwangxiaozhang.user.service.service.UserInfoService;
import com.hebeiwangxiaozhang.user.service.utils.RedisCommonProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/user/info")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @RequestMapping("/check-phone-bind-status")
    public CommonResponse checkPhoneBindStatus(@RequestHeader String personId) {
        return userInfoService.checkPhoneBindStatus(personId);
    }

    //绑定手机号
    @RequestMapping("/bind-phone-number")
    public CommonResponse bindPhoneNumber(@RequestHeader String personId, @RequestParam String phoneNumber, @RequestParam String code) {
        return userInfoService.bindPhoneNumber(personId, phoneNumber, code);
    }

    @RequestMapping("/get-by-token")
    public CommonResponse getUserInfoByToken(@RequestParam String token) {
        return userInfoService.getUserInfoByToken(token);
    }
}
